using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Layout;
using System.Drawing;
using System.Windows.Forms;

namespace CSDesktopUsiXMLRenderer
{
    class UsiXMLFlowLayoutManager : UsiXMLLayoutManagerRenderer
    {

        public override String getValidElementName()
        {
            return "flowBox";
        }

        public override ControlBox processRenderization(XmlNode element, ref Form mainForm)
        {
            XmlElement elm = (XmlElement)element;

            String alignmentAttribute = elm.GetAttribute("alignment");
            ElementsParser parser = new ElementsParser();
            
            FlowLayout flowLayout = new FlowLayout();
            flowLayout.Align = parser.parseFlowLayoutAlignment(alignmentAttribute);
            AreaPane controlPane = new ResizeablePane(mainForm, new Rectangle(), new FlowLayout());

            foreach (XmlNode node in element.ChildNodes)
            {
                Control control = (new RendererFactory()).getFirstElementRenderer(this.usiXMLInterfaceRenderer).renderElement(node);
                controlPane.Add(control);
            }
            
 
            
            return null;
        }

        public override UsiXMLLayoutManagerRenderer getNextRenderer()
        {
            return null;
        }


    }
}
